
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Page</title>
<meta name="generator"
	content="90 Second Website Builder - http://www.90secondwebsitebuilder.com">
<style type="text/css">
</style>
<script type="text/javascript">
	var arr;
	var option;
	var yearT;
	var monthT;
	var dayT;
	var monthArray;
	var selectedDate;
	function srcChange(selDate) {
		selectedDate = selDate;

		{

			var temp = document.getElementById("yearList");

			arr = new Array();
			arr[0] = "select year";
			for ( var i = 1; i < 102; i = i + 1) {
				arr[i] = (i + 1999) + "";
			}

			temp.disabled = false;
			temp.length = 0;
			for ( var i = 0; i < arr.length; i++) {
				option = new Option(arr[i], arr[i]);
				temp.options[i] = option;
			}

			temp = document.getElementById("monthList");
			monthArray = new Array("Select Month", "January", "February",
					"March", "April", "May", "June", "July", "August",
					"September", "October", "Novemvber", "December");
			temp.disabled = false;
			temp.length = 0;

			for ( var i = 0; i < monthArray.length; i++) {
				option = new Option(monthArray[i], monthArray[i]);
				temp.options[i] = option;
			}

		}
	}
	function yearChange(selYear) {
		yearT = selYear
	}
	function dayChange(selday) {
		dayT = selday
	}

	function monthChange(val) {
		var temp = document.getElementById("dayList");
		var numDays = 0;
		monthT = val;
		switch (val) {
		case "January":
		case "March":
		case "May":
		case "July":
		case "August":
		case "October":
		case "December":
			numDays = 31;
			break;
		case "April":
		case "June":
		case "September":
		case "Novemvber":
			numDays = 30;
			break;

		case "February":
			if (((yearT % 4 == 0) && !(yearT % 100 == 0)) || (yearT % 400 == 0))
				numDays = 29;
			else
				numDays = 28;
			break;

		}

		arr = new Array();
		arr[0] = "select day";
		for ( var i = 1; i < (numDays + 1); i = i + 1) {
			arr[i] = (i) + "";
		}

		temp.disabled = false;
		temp.length = 0;

		for ( var i = 0; i < arr.length; i++) {
			option = new Option(arr[i], arr[i]);
			temp.options[i] = option;
		}

	}
	function setDates() {
		if (selectedDate == "StartDate") {
			setPlanStartDate();
		} else if (selectedDate == "EndDate") {
			setPlanEndDate();
		}

	}

	function setPlanStartDate() {

		$.getJSON('@{ActionPlanController.setStartDate()}', {
			'planId' : document.getElementById("actionPlanID").value,
			'organizerId' : document.getElementById("organizerID").value,
			'y' : yearT,
			'm' : monthArray.indexOf(monthT),
			'd' : dayT
		}, function(data) {
			$('#one').jGrowl(data.res);
		});

	}

	function setPlanEndDate() {

		$.getJSON('@{ActionPlanController.setEndDate()}', {
			'planId' : document.getElementById("actionPlanID").value,
			'organizerId' : document.getElementById("organizerID").value,
			'y' : yearT,
			'm' : monthArray.indexOf(monthT),
			'd' : dayT
		}, function(data) {
			$('#one').jGrowl(data.res);
		});

	}
</script>
</head>







<body>
	<select id="startEnd" onchange="javascript:srcChange(this.value)">
		<option value="">assign dates</option>
		<option value="StartDate">assign start date</option>
		<option value="EndDate">assign end date</option>
	</select>

	<select id="yearList" onchange="javascript:yearChange(this.value)"><option
			value="year">select year</option>
	</select>
	<select id="monthList" onchange="javascript:monthChange(this.value)"><option
			value="month">select month</option>
	</select>
	<select id="dayList" onchange="javascript:dayChange(this.value)"><option
			value="day">select day</option>
	</select>
	<input type="button" value="Submit" onclick="javascript:setDates()" />
	<input id="actionPlanID" type="hidden" value="${actionPlanID}" />
	<input id="organizerID" type="hidden" value="${organizerID}" />
</body>

</html>